-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solana ChainWriter #935
base: develop
Are you sure you want to change the base?
Solana ChainWriter #935
Conversation
8c8a858
to
845a9a6
Compare
845a9a6
to
13cf316
Compare
7332617
to
17379b5
Compare
17379b5
to
93cba43
Compare
* Added ChainWriter unit tests for GetFeeComponents and GetTransactionStatus * Created SubmitTransaction tests * Created SubmitTransaction tests * Moved txm utils into own package and generated txm mock * Updated chain writer tests to use txm mock * Added GetAddresses unit test and fixed SubmitTransaction unit test * Fixed linting and removed file read for IDL * Fixed filter lookup table error case and fixed linting * Added filter lookup table addresses unit tests * Added new test case and fixed formatting issues * Addressed golang lint suggestions * Cleaned out unused dependency and fixed remaining golang lint errors * Added derived lookup table indeces unit tests --------- Co-authored-by: Silas Lenihan <[email protected]>
b852c76
to
51de345
Compare
Quality Gate failedFailed conditions |
} | ||
|
||
// Enqueue transaction | ||
if err = s.txm.Enqueue(ctx, accounts[0].PublicKey.String(), tx, &transactionID, blockhash.Value.LastValidBlockHeight); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config doesn't have any validation for accounts lookup having any entries, so wouldn't this panic if one of the methodConfigs has no account lookups listed? You should check for accounts size
return filteredLookupTables | ||
} | ||
|
||
func (s *SolanaChainWriterService) SubmitTransaction(ctx context.Context, contractName, method string, args any, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint nit
func (s *SolanaChainWriterService) SubmitTransaction(ctx context.Context, contractName, method string, args any, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int) error { | |
func (s *SolanaChainWriterService) SubmitTransaction(ctx context.Context, contractName, method string, args any, transactionID string, toAddress string, _ *types.TxMeta, _ *big.Int) error { |
|
||
for _, seed := range lookup.Seeds { | ||
if lookupSeed, ok := seed.(AccountLookup); ok { | ||
// Get value from a location (This doens't have to be an address, it can be any value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint
// Get value from a location (This doens't have to be an address, it can be any value) | |
// Get value from a location (This doens't have to be an address, it can be any value) |
} | ||
|
||
// GetValuesAtLocation parses through nested types and arrays to find all locations of values | ||
func GetValuesAtLocation(args any, location string) ([][]byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Callers in multiple locations are trying to access response slice elem by index without checking the size which is panic prone
var lookupTableMetas []*solana.AccountMeta | ||
|
||
// Iterate over each address of the lookup table | ||
for _, addressMeta := range lookupTableAddresses { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to get empty slice of lookupTableAddresses, if it is is that okay? If not maybe throw an error here
// Read the full list of addresses from the lookup table | ||
addresses, err := getLookupTableAddresses(ctx, reader, addressMeta.PublicKey) | ||
if err != nil { | ||
return nil, nil, fmt.Errorf("error fetching lookup table address: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to also log the table address here?
Description
Related Tickets:
NONEVM-753
NONEVM-963
NONEVM-964
Requires Dependencies
Resolves Dependencies